<template>
	<div class="app">
		<top></top>
		<div class="center">
			<left></left>
			<div class="right kanban">
				<upload-excel-component @on-selected-file="exportData" class="btnp" :buttonName="value"></upload-excel-component>
			</div>
		</div>
		<foot></foot>
	</div>
</template>

<script>
	import axios from "axios";
	import top from '@/components/top.vue'
	import left from '@/components/left.vue'
	import foot from '@/components/foot.vue'
  import UploadExcelComponent from "@/components/UploadExcel/index.vue";
	export default{
		components: {
			"left": left,
			"top": top,
			"foot": foot,
      UploadExcelComponent
		},
		name: 'kanban',
		data(){
			return{
				msg:"hello",
				options:"",
				value:"导入蜻蜓fm福利号码"
			}
		},
		created() {

        axios.post("/api/plan-market/aliyun/login")
              .then(function(response) {
                  console.log(response)
              })
		},
    //批量导入生产数据
    methods:{
          exportData(data) {
            var that = this;
            var list = []
            for(var i = 0 ;i < data.results.length; i++){
                var obj = {}
                obj['mobile'] = data.results[i]['mobile']
                obj['source'] = data.results[i]['source']
                obj['times'] = data.results[i]['times']
                list.push(obj)
            }
            axios.post("/api/plan-market/benefit/logs/import", {data:list})
              .then(function(response) {
                  console.log(response)
              })
          }


      }
  }

</script>

<style lang="scss" scoped>
	.app{
		margin: 0; padding: 0; background: #EFEFEF;
		.center{ width: 1366px; margin: 0 auto; display: flex; justify-content: space-between;
			.kanban{ flex-basis: 1166px; background: #FFFFFF}
		}
	}
</style>
